/**
 * 2010(c) Copyright Oceansoft Information System Co.,LTD. All rights reserved.
 * <p>
 * Compile: JDK 1.6+
 * <p>
 * 版权所有(C)：江苏欧索软件有限公司
 * <p>
 * 公司名称：江苏欧索软件有限公司
 * <p>
 * 公司地址：中国苏州科技城青山路1号
 * <p>
 * 网址: http://www.oceansoft.com.cn
 * <p>
 * 作者: 090922(陈伟)
 * <p>
 * 文件名: com.oceansoft.pap.api.entity.Result.java
 * <p>
 * 类产生时间: 13-12-4 下午3:29
 * <p>
 * 负责人: 090922(陈伟)
 * <p>
 * Email:javacspring@gmail.com
 * <p>
 * 所在组 : 掌上公安应用平台
 * <p>
 * 所在部门: 开发部--手持技术部
 * <p>
 * <p>
 */
package com.oceansoft.mobile.common.base.entity;

/**
 * 请求响应结果
 *
 * @author: chenw
 * @create: 13-12-4 下午3:29
 */
public class Result {

    public static final int SUCC = 200;
    public static final int SUCC2 = 2001;
    public static final int NO_DATA = -1;
    public static final int DUPLICATE = -2;
    public static final int FAILURE = 0;
    public static final int FORBIDDEN = 403;
    public static final int TIMEOUT = 503;

    private boolean succ = true;
    private int code = SUCC;
    private Object data;
    private String desc = null;

    public Result() {
    }

    public Result(int code, String desc) {
        this.succ = SUCC == code || NO_DATA == code;
        this.code = code;
        this.desc = desc;
    }
    
    public Result(int code,boolean success, String desc) {
        this.code = code;
        this.succ = success;
        this.desc = desc;
    }
    

    public Result(boolean succ, Object data) {
		super();
		this.succ = succ;
		this.data = data;
	}

	/**
     * 默认返回成功
     *
     * @param data Object 返回数据
     */
    public Result(Object data) {
        this.data = data;
        this.succ = true;
    }

   
    public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public boolean isSucc() {
        return succ;
    }

    public void setSucc(boolean succ) {
        this.succ = succ;
    }

    @Override
    public String toString() {
        return "Result{" + "code=" + code + ", succ=" + succ + ", data=" + data + ", desc='" + desc + '\'' + '}';
    }
}
